﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.IO;
using ReadWaterlevelData.ReaderProxy;
using Husb.DataUtil;

namespace ReadWaterlevelData
{
    public partial class MainForm : Form
    {
        System.Configuration.Configuration config = null;
        public WaterlevelSettings settings = null;
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            if ((File.GetAttributes(config.FilePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
            {
                try
                {
                    File.SetAttributes(config.FilePath, FileAttributes.Archive);//~FileAttributes.ReadOnly
                }
                catch (UnauthorizedAccessException ex)
                {
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return;
                }
            }

            settings = config.GetSection("mySettings") as WaterlevelSettings;
            if (settings == null || settings.BaseDate == DateTime.MinValue)
            {
                MessageBox.Show("您必须先设置运行参数，否则本程序无法执行相应功能！", "警告");
                WriteLine(txtLog, "您需要先设置参数，然后再从新启动本程序！点击‘参数’");
                return;
            }

            ReadData(settings);

            timerReader.Enabled = true;
        }

        private void timerReader_Tick(object sender, EventArgs e)
        {
            ReadData();
        }

        private void ReadData()
        {
            //WaterlevelSettings settings = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).GetSection("mySettings") as WaterlevelSettings;
            ReadData(settings);
        }

        private void ReadData(WaterlevelSettings settings)
        {
            if (settings == null || settings.BaseDate == DateTime.MinValue)
                return;
            DateTime newDate = settings.BaseDate.AddMinutes(settings.Interval);
            //WriteLine(txtLog, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + settings.ToString() + newDate.ToString());
            // BaseDate为上次执行时间
            // newDate这次将要执行的时间，如果当前时间到了这次将要执行的时间，则执行
            if (newDate <= DateTime.Now)
            {
                ReaderProxy.ReadWaterLevelService proxy = CreateProxy();
                int offset = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["TimeSpan"]);
                int cnt = InsertWaterlevelData(newDate.AddMinutes(-offset).ToString("yyyy-MM-dd HH:mm:ss"), newDate.AddMinutes(offset).ToString("yyyy-MM-dd HH:mm:ss"), proxy);
                WriteLine(txtLog, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 读取了 " + cnt.ToString() + "条数据。数据采集时间为从 " + newDate.AddMinutes(-offset).ToString("yyyy-MM-dd HH:mm:ss") + " 到 " + newDate.AddMinutes(offset).ToString("yyyy-MM-dd HH:mm:ss"));
                WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 读取了 " + cnt.ToString() + "条数据。数据采集时间为从 " + newDate.AddMinutes(-offset).ToString("yyyy-MM-dd HH:mm:ss") + " 到 " + newDate.AddMinutes(offset).ToString("yyyy-MM-dd HH:mm:ss"));
                settings.BaseDate = DateTime.Parse(newDate.ToString("yyyy-MM-dd HH:mm:ss"));
                if (!settings.ElementInformation.IsLocked)
                {
                    config.Save();
                    ConfigurationManager.RefreshSection("mySettings");
                }
            }
        }


        

       

        internal ReaderProxy.ReadWaterLevelService CreateProxy()
        {
            ReaderProxy.ReadWaterLevelService proxy = null;
            try
            {
                proxy  = new ReadWaterlevelData.ReaderProxy.ReadWaterLevelService();                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return proxy;
        }

        internal int InsertWaterlevelData(string startDate, string endDate, ReaderProxy.ReadWaterLevelService proxy)
        {
            //WaterlevelData[] data = proxy.ReadWaterlevel(startDate, endDate);
            WaterlevelData[] data = GetData();

            if (data == null || data.Length == 0)
                return 0;

            //string sql = System.Configuration.ConfigurationManager.AppSettings["InsertSQL"];

            //int cnt = 0;

            //foreach (WaterlevelData d in data)
            //{
            //    cnt = cnt + Husb.DataUtil.DataAccessUtil.ExecuteNonQuery(String.Format(sql, d.WellCode, d.MonitorTime, d.Waterlevel), new List<DatabaseParameter>(), false, false);
            //}
            //proxy.UpdateConcurrencyByDate(startDate, endDate);

            //return cnt;

            string sql = System.Configuration.ConfigurationManager.AppSettings["InsertSelect"];
            string sql1 = sql.Substring(0, sql.IndexOf(" SELECT "));
            string sql2 = sql.Substring(sql.IndexOf(" SELECT "));

            int per = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["InsertPer"]);
            StringBuilder sb = new StringBuilder(sql1);
            int cnt = 0;

            if (data.Length == 1)
            {
                sb.Append(String.Format(sql2, data[0].WellCode, data[0].MonitorTime, data[0].Waterlevel));

                return Husb.DataUtil.DataAccessUtil.ExecuteNonQuery(sb.ToString(), new List<DatabaseParameter>(), false, false);
            }


            for (int i = 0; i < data.Length; i++)
            {
                if ( (i < per || i % per != 0) && i < data.Length - 1)
                {
                    sb.Append(String.Format(sql2, data[i].WellCode, data[i].MonitorTime, data[i].Waterlevel) + " UNION " + Environment.NewLine);
                }
                else
                {
                    sb.Append(String.Format(sql2, data[i].WellCode, data[i].MonitorTime, data[i].Waterlevel));
                    cnt = cnt + Husb.DataUtil.DataAccessUtil.ExecuteNonQuery(sb.ToString(), new List<DatabaseParameter>(), false, false);

                    sb.Length = 0;
                    sb.Append(sql1);
                }
            }

            proxy.UpdateConcurrencyByDate(startDate, endDate);

            return cnt;
        }

        

        private void mnuItemOption_Click(object sender, EventArgs e)
        {
            OptionForm frm = new OptionForm(settings, config);
            frm.Owner = this;
            frm.ShowDialog();
        }

        public static void WriteLine(TextBox txtBox, String text)
        {
            txtBox.Focus();
            txtBox.AppendText(text + Environment.NewLine);
            txtBox.ScrollToCaret();
            System.Windows.Forms.Application.DoEvents();
        }

        private void mnuItemManualRead_Click(object sender, EventArgs e)
        {
            DateForm frm = new DateForm();

            if (DialogResult.OK == frm.ShowDialog())
            {
                ReaderProxy.ReadWaterLevelService proxy = CreateProxy();
                int cnt = InsertWaterlevelData(frm.StartDate.ToString("yyyy-MM-dd HH:mm:ss"), frm.EndDate.ToString("yyyy-MM-dd HH:mm:ss"), proxy);
                WriteLine(txtLog, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 读取了 " + cnt.ToString() + "条数据。");

                WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 手工操作，读取了 " + cnt.ToString() + "条数据。");
            }
        }

        public const string LogFolder = "\\Log\\";
        public static void WriteLog(string logMessage)
        {
            string logFileName = GetLogFileName();
            using (StreamWriter w = File.AppendText(logFileName))
            {
                w.WriteLine(logMessage);
                w.Flush();
                w.Close();
            }
        }

        public static string GetLogFileName()
        {
            string logDirectory = Application.StartupPath + LogFolder;
            if (!Directory.Exists(logDirectory))
            {
                Directory.CreateDirectory(logDirectory);
            }
            string logFile = logDirectory + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            if (!File.Exists(logFile))
            {
                FileStream log = File.Create(logFile);
                log.Close();
            }
            return logFile;
        }


        private WaterlevelData[]  GetData()
        {
            WaterlevelData[] data = {
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"},
                                        new WaterlevelData { WellCode="abcd", MonitorTime="2010-02-02 23:12:16", Waterlevel="6"}
                                        

                                    };
            return data;
        }
    }
}
